<template>
    <!-- 基础组件 - 图片（盖章签字） -->
    <el-image
        :style="{
            'width': `${element.options.width}mm`,
            'height': `${element.options.height == 0 ? 'initial': element.options.height + 'mm'}`
        }"
        draggable="false"
        :src="imgSrc"
        :fit="element.options.fit"
        :alt="element.options.alt">
    </el-image>
</template>

<script>
import seal from '../../../../../../images/seal.png';
import sign from "../../../../../../images/sign.png"
export default {
    name: "DesignImage",
    props: {
        element: {
            type: Object
        }
    },
    data() {
        return {
            imgSrc: seal
        }
    },
    methods: {
        watchType(val) {
            if (val === 'seal') this.imgSrc = seal;
            else if (val === 'sign') this.imgSrc = sign;
        }
    },
    watch: {
        'element.options.type': 'watchType'
    },
    mounted() {
        this.$nextTick(() => {
            this.watchType(this.element.options.type);
        })
    }
}
</script>
